home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / updates / update16.zoo / gcc-2.0 / tm-atari.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-06  |  10.6 KB  |  378 lines

  1. /* Definitions of target machine for GNU compiler.  atariST/TT version.
  2.    Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* The following Macros control the compilation
  21.  *
  22.  *    CROSSATARI    defined when making cross compiler for TOS or Minix
  23.  *    MINIX        defined when making cross compiler for MINIX only
  24.  *    atariminix    defined when making compiler for MINIX
  25.  *    atarist        defined when making compiler for TOS
  26.  */
  27.  
  28. #include "m68k.h"
  29.  
  30. #if defined(__GNUC__)
  31. #  if defined(alloca)
  32. #    undef alloca
  33. #  endif
  34. #  define alloca(x) __builtin_alloca(x)
  35. #endif
  36.  
  37. #if defined(sparc)
  38. # if !defined(alloca)
  39. #    include <alloca.h>
  40. # endif
  41. #endif
  42.  
  43. /* See tm-m68k.h.  0 means 68000 with no 68881.  */
  44.  
  45. #define TARGET_DEFAULT 0    /* use this for a regular ST       */
  46. /* #define TARGET_DEFAULT 2    use this for a ST with 68881/82    */
  47. /* #define TARGET_DEFAULT 7    use this for a TT with 68881/82    */
  48. /* #define TARGET_DEFAULT 5    use this for a TT withOUT 68881/82 */
  49.  
  50. /* These compiler options take an argument.  We ignore -target for now.  */
  51.  
  52. #define WORD_SWITCH_TAKES_ARG(STR)                \
  53.  (!strcmp (STR, "Tdata") || !strcmp (STR, "include")        \
  54.   || !strcmp (STR, "imacros") || !strcmp (STR, "target")    \
  55.   || !strcmp (STR, "assert"))
  56.  
  57. /* -m68020 requires special flags to the assembler.  */
  58.  
  59. /* -m68000 (on atari) need this flag to assembler, otherwise pc relative
  60.    code is produced where it should not be (in places where the
  61.    68000 only allows data ALTERABLE addressing modes) (++jrb 03/19/89) */
  62. #if (TARGET_DEFAULT & 5)
  63. /* for the TT etc (020/030) */
  64. #define ASM_SPEC \
  65.  "%{m68000:-mc68000}%{mc68000:-mc68000}%{!mc68000:%{!m68000:-mc68020}}"
  66. #else
  67. /* for a regular 68k ST */
  68. #define ASM_SPEC "%{m68020:-mc68020}%{mc68020:-mc68020} \
  69.                   %{!mc68020:%{!m68020:-mc68000}}"
  70. #endif
  71.  
  72. /* Names to predefine in the preprocessor for this target machine.  */
  73.  
  74. #if (defined(MINIX) || defined(atariminix))
  75. #  if (TARGET_DEFAULT & 5)
  76. #    if(TARGET_DEFAULT & 2)
  77. #      define CPP_PREDEFINES "-DATARI_ST -Dminix -Dm68k -DATARI_TT -DM68881"
  78. #    else
  79. #      define CPP_PREDEFINES "-DATARI_ST -Dminix -Dm68k -DATARI_TT"
  80. #    endif
  81. #  else
  82. #    if(TARGET_DEFAULT & 2)
  83. #      define CPP_PREDEFINES "-DATARI_ST -Dminix -Dm68k -DM68881"
  84. #    else
  85. #      define CPP_PREDEFINES "-DATARI_ST -Dminix -Dm68k"
  86. #    endif
  87. #  endif
  88. #else
  89. #  if (TARGET_DEFAULT & 5)
  90. #    if(TARGET_DEFAULT & 2)
  91. #      define CPP_PREDEFINES "-Datarist -Dgem -Dm68k -Dataritt -DM68881"
  92. #    else
  93. #      define CPP_PREDEFINES "-Datarist -Dgem -Dm68k -Dataritt"
  94. #    endif
  95. #  else
  96. #    if(TARGET_DEFAULT & 2)
  97. #      define CPP_PREDEFINES "-Datarist -Dgem -Dm68k -DM68881"
  98. #    else
  99. #      define CPP_PREDEFINES "-Datarist -Dgem -Dm68k"
  100. #    endif
  101. #  endif
  102. #endif
  103.  
  104. #define PTRDIFF_TYPE "long int"
  105. #define SIZE_TYPE "long unsigned int"
  106. #undef WCHAR_TYPE
  107. #undef WCHAR_TYPE_SIZE
  108. #define WCHAR_TYPE "int"
  109. #define WCHAR_TYPE_SIZE 32 /* just for building the compiler */
  110.  
  111. /* default exec dir */
  112. #ifndef STANDARD_EXEC_PREFIX
  113. #ifdef MINIX
  114. #define STANDARD_EXEC_PREFIX "/net/acae127/home/bammi/atari/cross-minix/lib/gcc-"
  115. #else
  116. #ifdef atariminix
  117. #define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-"
  118. #else
  119. #define STANDARD_EXEC_PREFIX "/net/acae127/home/bammi/atari/cross-gcc/lib/gcc-"
  120. #endif
  121. #endif
  122. #endif
  123.  
  124. #define STANDARD_STARTFILE_PREFIX ""
  125. #define EXECUTABLE_SUFFIX ".ttp"
  126.  
  127. /* Alignment of field after `int : 0' in a structure.  */
  128. /* recent gcc's have this as 16, this is left in for the benfit of */
  129.  /* older gcc */
  130. #undef EMPTY_FIELD_BOUNDARY
  131. #define EMPTY_FIELD_BOUNDARY 16
  132.  
  133. /* Every structure or union's size must be a multiple of 2 bytes.  */
  134.  
  135. #undef STRUCTURE_SIZE_BOUNDARY
  136. #define STRUCTURE_SIZE_BOUNDARY 16
  137.  
  138. /* code seems to assume this... */
  139. #define DBX_DEBUGGING_INFO
  140.  
  141. #ifndef HAVE_VPRINTF
  142. #define HAVE_VPRINTF 1
  143. #endif
  144.  
  145. #ifdef abort
  146. #undef abort
  147. #define abort fancy_abort
  148. #endif
  149.  
  150.  
  151. /* the following stolen from tm-sun3.h, they seem to work better */
  152. /* This is how to output an assembler line defining a `double' constant.  */
  153.  
  154. /* fake out isinf for !sun for now */
  155. #ifndef sun
  156. #define isinf(X) (0)
  157. #endif
  158.  
  159. #define double_is_minus_zero(X)    ((X) == -0.0)
  160.  
  161. #undef ASM_OUTPUT_DOUBLE
  162. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)                    \
  163.   (isinf ((VALUE))                            \
  164.    ? fprintf (FILE, "\t.double 0r%s99e999\n", ((VALUE) > 0 ? "" : "-")) \
  165.    : double_is_minus_zero ((VALUE))                    \
  166.    ? fprintf (FILE, "\t.long 0x80000000,0\n")                \
  167.    : fprintf (FILE, "\t.double 0r%.20e\n", (VALUE)))
  168.  
  169. /* This is how to output an assembler line defining a `float' constant.  */
  170.  
  171. #undef ASM_OUTPUT_FLOAT
  172. #define ASM_OUTPUT_FLOAT(FILE,VALUE)                    \
  173.   (isinf ((VALUE))                            \
  174.    ? fprintf (FILE, "\t.single 0r%s99e999\n", ((VALUE) > 0 ? "" : "-")) \
  175.    : double_is_minus_zero ((VALUE))                    \
  176.    ? fprintf (FILE, "\t.long 0x80000000\n")                \
  177.    : fprintf (FILE, "\t.single 0r%.20e\n", (VALUE)))
  178.  
  179. #undef ASM_OUTPUT_FLOAT_OPERAND
  180. #define ASM_OUTPUT_FLOAT_OPERAND(FILE,VALUE)                \
  181.   (isinf ((VALUE))                            \
  182.    ? fprintf (FILE, "#0r%s99e999", ((VALUE) > 0 ? "" : "-"))         \
  183.    : double_is_minus_zero ((VALUE))                    \
  184.    ? fprintf (FILE, "#0r-0.0")                        \
  185.    : fprintf (FILE, "#0r%.9g", (VALUE)))
  186.  
  187. #undef ASM_OUTPUT_DOUBLE_OPERAND
  188. #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)                \
  189.   (isinf ((VALUE))                            \
  190.    ? fprintf (FILE, "#0r%s99e999", ((VALUE) > 0 ? "" : "-"))        \
  191.    : double_is_minus_zero ((VALUE))                    \
  192.    ? fprintf (FILE, "#0r-0.0")                        \
  193.    : fprintf (FILE, "#0r%.20g", (VALUE)))
  194.  
  195.  
  196. /* specs for start file and link specs */
  197.  
  198. #ifndef CROSSATARI
  199.  
  200. #ifdef atariminix
  201. #define STARTFILE_SPEC  \
  202.   "%{pg:/usr/local/lib/gcrtso.o%s}\
  203.    %{!pg:\
  204.          %{p:/usr/local/lib/mcrtso.o%s}\
  205.          %{!p:/usr/local/lib/crtso.o%s}}"
  206. #else /* atarist */
  207. #define STARTFILE_SPEC  \
  208.  "%{mint:\
  209.      %{pg:$GNULIB$\\mgcrt0.o%s}\
  210.      %{!pg:\
  211.          %{p:$GNULIB$\\mmcrt0.o%s}\
  212.          %{!p:$GNULIB$\\mcrt0.o%s}}}\
  213. \
  214.   %{!mint:\
  215.      %{pg:$GNULIB$\\gcrt0.o%s}\
  216.      %{!pg:\
  217.          %{p:$GNULIB$\\mcrt0.o%s}\
  218.          %{!p:$GNULIB$\\crt0.o%s}}}"
  219. #endif
  220.  
  221. #else    /* CROSSATARI */
  222.  
  223. #ifdef MINIX
  224. #define STARTFILE_SPEC  \
  225.   "%{pg:/net/acae127/home/bammi/atari/cross-minix/lib/gcrtso.o%s}\
  226.    %{!pg:\
  227.          %{p:/net/acae127/home/bammi/atari/cross-minix/lib/mcrtso.o%s}\
  228.          %{!p:/net/acae127/home/bammi/atari/cross-minix/lib/crtso.o%s}}"
  229. #else
  230. #define STARTFILE_SPEC  \
  231.   "%{mint:\
  232.       %{pg:/net/acae127/home/bammi/atari/cross-gcc/lib/mgcrt0.o%s}\
  233.       %{!pg:\
  234.              %{p:/net/acae127/home/bammi/atari/cross-gcc/lib/mmcrt0.o%s}\
  235.              %{!p:/net/acae127/home/bammi/atari/cross-gcc/lib/mcrt0.o%s}}}\
  236. \
  237.   %{!mint:\
  238.       %{pg:/net/acae127/home/bammi/atari/cross-gcc/lib/gcrt0.o%s}\
  239.       %{!pg:\
  240.              %{p:/net/acae127/home/bammi/atari/cross-gcc/lib/mcrt0.o%s}\
  241.              %{!p:/net/acae127/home/bammi/atari/cross-gcc/lib/crt0.o%s}}}"
  242. #endif
  243. #endif /* CROSSATARI */
  244.  
  245. #ifdef MINIX
  246. #define LIB_SPEC \
  247.   "%{mshort:/net/acae127/home/bammi/atari/cross-minix/lib/libc.a}\
  248.    %{!mshort:/net/acae127/home/bammi/atari/cross-minix/lib/libc32.a}"
  249. #else
  250. #ifdef atariminix
  251. #define LIB_SPEC \
  252.   "%{mshort:/usr/local/lib/libc.a}\
  253.    %{!mshort:/usr/local/lib/libc32.a}"
  254. #else /* atarist cross or native */
  255.  
  256. #ifndef __GPLUSPLUS__
  257. #define LIB_SPEC \
  258.  "%{mint:\
  259.    %{!gg:\
  260.          %{mshort:-lmint16 -lgnu16}\
  261.          %{!mshort:-lmint -lgnu}}\
  262.     %{gg:\
  263.          %{mshort:-lmintg16 -lgnugdb16}\
  264.          %{!mshort:-lmintg -lgnugdb}}}\
  265. \
  266.   %{!mint:\
  267.    %{!gg:\
  268.          %{mshort:-lgnu16}\
  269.          %{!mshort:-lgnu}}\
  270.     %{gg:\
  271.          %{mshort:-lgnugdb16}\
  272.          %{!mshort:-lgnugdb}}}"
  273.  
  274. #else /* atariSt g++ */
  275.  
  276. #define LIB_SPEC \
  277.  "%{mint:\
  278.    %{!gg:\
  279.          %{mshort:-lmint16 -lg++16 -lgnu16}\
  280.          %{!mshort:-lmint -lg++ -lgnu}}\
  281.     %{gg:\
  282.          %{mshort:-lmintg16 -lg++gdb16 -lgnugdb16}\
  283.          %{!mshort:-lmintg -lg++gdb -lgnugdb}}}\
  284. \
  285.   %{!mint:\
  286.    %{!gg:\
  287.          %{mshort:-lg++16 -lgnu16}\
  288.          %{!mshort:-lg++ -lgnu}}\
  289.     %{gg:\
  290.          %{mshort:-lg++gdb16 -lgnugdb16}\
  291.          %{!mshort:-lg++gdb -lgnugdb}}}"
  292. #endif
  293.  
  294. #endif
  295. #endif
  296.  
  297. /* add -mint : meanining
  298.    pre-procees with -D__MINT__
  299.    compile with -mint    (target_flags & 02000) (this flag is
  300.      currently not used by cc1, but maybe later)
  301.    link with mcrt0.o and -lmint -lgnu
  302.    
  303.  */
  304. #undef TARGET_SWITCHES
  305. #define TARGET_SWITCHES  \
  306.   { { "68020", 5},                \
  307.     { "c68020", 5},                \
  308.     { "68881", 2},                \
  309.     { "bitfield", 4},                \
  310.     { "68000", -5},                \
  311.     { "c68000", -5},                \
  312.     { "soft-float", -0102},            \
  313.     { "nobitfield", -4},            \
  314.     { "rtd", 8},                \
  315.     { "nortd", -8},                \
  316.     { "short", 040},                \
  317.     { "noshort", -040},                \
  318.     { "fpa", 0100},                \
  319.     { "nofpa", -0100},                \
  320.     { "sky", 0200},                \
  321.     { "nosky", -0200},                \
  322.     { "68040", 0407},                \
  323.     { "68030", -01400},                \
  324.     { "68030", 7},                \
  325.     { "68040-only", 01000},            \
  326.     { "int", 02000},                \
  327.     { "noint", -02000},                \
  328.     { "", TARGET_DEFAULT}}
  329.  
  330. #ifdef atarist
  331. #  ifdef ASM_OUTPUT_SOURCE_FILENAME
  332. #    undef ASM_OUTPUT_SOURCE_FILENAME
  333. #  endif
  334. #  define  ASM_OUTPUT_SOURCE_FILENAME(file, filename)     \
  335.     fprintf (file, "\t.stabs \"");         \
  336.         atari_output_filename(file, filename);        \
  337.     fprintf(file, "\",%d,0,0,Ltext\n", N_SOL)
  338. #endif
  339.  
  340. /* these two should never be used, #define them here so they are'nt
  341.    in cccp.c
  342. */
  343. #define STANDARD_INCLUDE_DIR    8086_sucks
  344. #define LOCAL_INCLUDE_DIR    80486_sucks
  345.  
  346. /* all the INCLUDE_DEFAULTS */
  347. #ifdef CROSSATARI    /* TOS or MINIX cross compiler */
  348. #  define SYSTEM_INCLUDE_DIR        CROSSINC
  349. #  define SYSTEM_GPLUSPLUS_INCLUDE_DIR    GPLUSPLUS_INCLUDE_DIR
  350. #endif
  351.  
  352. #ifdef atarist        /* TOS native compiler */
  353. #  define SYSTEM_INCLUDE_DIR        "\\gnu\\lib"
  354. #  define SYSTEM_GPLUSPLUS_INCLUDE_DIR    "\\gnu\\g++-inc"
  355. #endif
  356.  
  357. #ifdef atariminix    /* MINIX native compiler */
  358. #  define SYSTEM_INCLUDE_DIR        "/usr/local/gcc-include"
  359. #  define SYSTEM_GPLUSPLUS_INCLUDE_DIR    "/usr/local/g++-inc"
  360. #endif
  361.  
  362. #define INCLUDE_DEFAULTS            \
  363.     {                        \
  364.           { SYSTEM_INCLUDE_DIR, 0 },        \
  365.           { SYSTEM_GPLUSPLUS_INCLUDE_DIR, 1 },  \
  366.           { 0, 0 }                \
  367.     }
  368.  
  369. #ifdef atarist
  370. void atari_output_filename();
  371. #endif
  372.  
  373. #ifdef atarist
  374. #define FILE_NAME_NONDIRECTORY(X)        \
  375.     atari_filename_nondirectory(X);
  376. extern char *atari_filename_nondirectory();
  377. #endif
  378.